Sentiment Analysis and Prediction of 2016 Elections based on Social Media


Preliminary Analysis

plot_ly(x = 1:61, y = 1:87, z = volcano, type = "heatmap")
set.seed(123)

x = 1:100
y1 = 2*x + rnorm(100)
y2 = -2*x + rnorm(100)

axis_template = list(
  showgrid = F,
  zeroline = F,
  nticks = 20,
  showline = T,
  title = "AXIS",
  mirror = "all")

plot_ly(
  x = x,
  y = y1,
  type = "scatter") %>%
  
  layout(
    xaxis = axis_template,
    yaxis = axis_template)
## No scatter mode specifed:
##   Setting the mode to markers
##   Read more about this attribute -> https://plot.ly/r/reference/#scatter-mode
plot_ly( x = c(1, 2, 3),
         y = c(5, 6, 4),
         type = "scatter",
         mode = "markers")
plot_ly(x = c(1, 2, 4), 
        y = c(2, 3, 2),
        type = "scatter",
        mode = "markers",
        marker = list(color = c("green", "blue", "red")))
plot_ly(x = x,
        y = y1, 
        type = "scatter",
        mode = "markers") %>%
  add_trace( x = x,
             y = y2) %>%
  layout(
    legend = list(x = 0.5, 
                  y = 1,
                  bgcolor = "#F3F3F3")
  )